/*
 * Copyright 2011 Google Inc. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.bsc.mgwt.client.ui;

import org.bsc.mgwt.client.place.MVPExplorerPlace;
import org.bsc.mgwt.client.place.Tab2Place;
import org.bsc.mgwt.client.place.Tab3Place;
import org.bsc.mgwt.client.widget.tabbar.MVPTabPanel;
import org.bsc.mgwt.client.widget.tabbar.SimpleTabBarButton;

import com.google.gwt.activity.shared.ActivityMapper;
import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;
import com.googlecode.mgwt.mvp.client.AnimationMapper;

/**
 * Sample implementation of {@link MVPTabView}.
 */
public class MVPTabViewImpl extends Composite implements MVPTabView {

	interface Binder extends UiBinder<Widget, MVPTabViewImpl> {
	}
	
	private static final Binder binder = GWT.create(Binder.class);

	private Presenter listener;

	@UiField(provided=true)
	MVPTabPanel tabMaster = new MVPTabPanel();
	
	public MVPTabViewImpl() {
		
		initWidget(binder.createAndBindUi(this));
		
		tabMaster.add(new SimpleTabBarButton() {{ setText("Explorer"); }}, new MVPExplorerPlace());		
		tabMaster.add(new SimpleTabBarButton() {{ setText("User(s)"); }}, new Tab2Place("tab2") );
		tabMaster.add(new SimpleTabBarButton() {{ setText("Info(s)"); }}, new Tab3Place("tab start"));
		tabMaster.add(new SimpleTabBarButton() {{ setText("Info Service(s)"); }}, new Tab3Place("tab3"));
		//tabMaster.add(new SimpleTabBarButton() {{ setText("Adv. Service(s)"); }}, new Tab2Place("tab4"));
	
	}

	@Override
	public void setName(String name) {
	}

	@Override
	public void setPresenter(Presenter listener) {
		this.listener = listener;
	}

	@Override
	public void init(ActivityMapper mainActivityMapper,	AnimationMapper mainAnimationMapper) {
		tabMaster.init(mainActivityMapper, mainAnimationMapper);
	}

/*
	class MainAnimationMapper implements AnimationMapper {

		@Override
		public Animation getAnimation(Place oldPlace, Place newPlace) {
			return Animation.SLIDE;
		}

	}

	ActivityMapper mainActivityMapper ;
	
	public void init( ActivityMapper mainActivityMapper, EventBus eventBus) {
		
		SimplePanel mainContainer = new SimplePanel();
		mainContainer.getElement().setId("main");
		AnimatableDisplay mainDisplay = GWT.create(AnimatableDisplay.class);

		//TabletMainActivityMapper tabletMainActivityMapper = new TabletMainActivityMapper(clientFactory);

		AnimationMapper tabletMainAnimationMapper = new TabletMainAnimationMapper();

		AnimatingActivityManager mainActivityManager = new AnimatingActivityManager(mainActivityMapper, tabletMainAnimationMapper, clientFactory.getEventBus());

		mainActivityManager.setDisplay(mainDisplay);
		mainContainer.setWidget(mainDisplay);

	}
*/	
}
